namespace Digitalmes.Domain.Entities.Mes.Masters;

/// <summary>
/// 物料定义。
/// </summary>
[SugarTable("md_material")]
public sealed class MdMaterial : AuditedEntity, ISoftDelete
{
    /// <summary>
    /// 物料代码
    /// </summary>
    [NotNull]
    public string? Code { get; set; }

    /// <summary>
    /// 物料名称
    /// </summary>
    [NotNull]
    public string? Name { get; set; }

    /// <summary>
    /// 物料类型（1->成品；2->半成品；3->原材料）
    /// </summary>
    public MaterialTypeEnum Type { get; set; }

    /// <summary>
    /// 物料属性（1->关键物料；2->批次料）
    /// </summary>
    public MaterialAttrEnum Attr { get; set; }

    /// <summary>
    /// 物料型号
    /// </summary>
    public string? Model { get; set; }

    /// <summary>
    /// 物料规格
    /// </summary>
    public string? Spec { get; set; }

    /// <summary>
    /// 计量单位
    /// </summary>
    public string? Unit { get; set; }

    /// <summary>
    /// 条码规则集合。
    /// </summary>
    /// <remarks>数据以 JSON 格式存储，支持原生 JSON 数据类型的数据库有 MySQL 5.7.8+、PostgreSQL 9.2+ 和 SQL Server 2016+ 等。</remarks>
    [NotNull]
    [SugarColumn(IsJson = true)]
    public List<string>? Rules { get; set; }

    /// <summary>
    /// 物料供应商
    /// </summary>
    public string? Supplier { get; set; }

    /// <summary>
    /// 生产日期
    /// </summary>
    public DateTime? ManufacturingDate { get; set; }

    /// <summary>
    /// 入库日期
    /// </summary>
    public DateTime? WarehousingDate { get; set; }

    /// <summary>
    /// 备注
    /// </summary>
    public string? Remark { get; set; }

    /// <summary>
    /// 启用状态（0->停用，1->启用）
    /// </summary>
    public EnabledStatusEnum Status { get; set; }

    public bool IsDeleted { get; set; }
}
